package pl.kaczanowscy.tomek.ipdl.examples


/**
 * @author tomek
 *
 */
public class AllExamples {
	
	static class StreamBuilder implements ExampleBuilder {
		private Map<String, String> data = new LinkedHashMap<String, String>()
		
		@Override
		public void setTitle(String title) {
			add("title", title)
		}
		
		@Override
		public void add(String key, String value) {
			data.put(key, value)			
		}
		
		public void print(OutputStream stream) {
			for (e in data) {
				stream.println(e.key)
				stream.println(e.value)
				stream.println ""
			}
		}
	}
	private static ExampleBuilder builder
	public static void main(String[] args) {
		builder = new StreamBuilder()
		TwoPlayersGameExample exampleA = new TwoPlayersGameExample(builder)
		exampleA.show()
		builder.print System.out
		
		builder = new StreamBuilder()
		TwoPlayersGameRoundListenerExample exampleB = new TwoPlayersGameRoundListenerExample(builder)
		exampleB.show()
		builder.print System.out
	}
	
}
